﻿using DevExpress.XtraEditors;
using SWF = System.Windows.Forms;

namespace Mota.XMLControls
{
    /// <summary>
    /// Represent Splitter and based on DX SplitCOntainerControl
    /// </summary>
    public class DXGuiSplitter:GuiSplitter
    {
        /// <summary>
        /// Create SplitContainerControl
        /// set Panel1 and Panel2 Autoscroll to true
        /// set Splitter position to 200
        /// </summary>
        public DXGuiSplitter()
        {
            visualControl = new SplitContainerControl();
            SplitContainerControl sc = visualControl as SplitContainerControl;
            sc.Panel1.AutoScroll = true;
            sc.Panel2.AutoScroll = true;
            sc.SplitterPosition = 200;

        }
        /// <summary>
        /// Set|Get SplitContainerControl Text property
        /// </summary>
        public override string Text
        {
            get
            {
                return (visualControl as SplitContainerControl).Text;
            }
            set
            {
                (visualControl as SplitContainerControl).Text = value;
            }
        }

        /// <summary>
        /// Set|Get Orientation
        /// </summary>
        public override SWF.Orientation Orientation
        {
            get
            {
                //DevExpress use Horizontal bool value, but winfroms use enum
                return ((visualControl as SplitContainerControl).Horizontal==true)?SWF.Orientation.Horizontal:SWF.Orientation.Vertical;
            }
            set
            {
                (visualControl as SplitContainerControl).Horizontal = (value==SWF.Orientation.Horizontal);
            }
        }

        /// <summary>
        /// Dummy element
        /// </summary>
        public override object Binding
        {
            get
            {
                return null;
            }
            set
            {
                //throw new NotImplementedException();
            }
        }
        /// <summary>
        /// Dummy element
        /// </summary>
        /// <param name="valueBinding"></param>
        public override void SetValue(object valueBinding)
        {
            //
        }

        public override object GetValue()
        {
            throw new System.NotImplementedException("Splitter dont have value");
        }
    }
}
